package com.itheima.health.controller.mobile;

import com.itheima.health.common.MessageConst;
import com.itheima.health.common.RedisConst;
import com.itheima.health.pojo.result.Result;
import com.itheima.health.service.ValidateCodeService;
import com.itheima.health.utils.AliyunSmsUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/mobile")
@Slf4j
public class ValidateCodeController {
    @Autowired
    private ValidateCodeService validateCodeService;
    /**
     * 发送验证码
     * @param type
     * @param telephone
     * @return
     */
    @PostMapping("/validateCode/send")
    public Result validateCodeSend(@RequestParam String type, @RequestParam String telephone) {
        log.info("[手机模块-发送验证码]type:{},telephone:{}",type,telephone);
        validateCodeService.validateCode(type, telephone);
        return new Result(true, MessageConst.SEND_VALIDATECODE_SUCCESS);
    }
}
